In this tutorial I will help you to create photo-realistic skyboxes for MOH:AA ( or most any game actually ).
Terragen is a fantastic program that lets you create outdoor environments and put a camera in thit to render exelent photographic quality pictures. It is not a free program, but the trial version allows you to render images up to 1200 * 960 resolution. So if you want more detail than that, you have to buy the program ( considering the possibilities of this program: its well spent money ). But this resolution is good enough for most maps ( the biggest standard sskyboxes shipped with MOH:AA are just 512 * 512 ).
Enough talk: get the Terragen application from http://www.planetside.co.uk/terragen/
I'm not going to teach you how to create landscapes in Terragen, there are some good documentation on this on the Terragen homepage. So play with the program a bit and see what it can do.
Here is one angle from one of the test renders I did while writing this tutorial ( the original is 960 * 960 ).
The first thing I rendered looked totally worthless. It was blocky and the promised photo-realism was nowhere to be found, then I found a little slider called "Detail" in the "Render Control" dialog window. Once you boost that to max, you get some sweet stuff (:eek:). But in doing so you also increase the rendering times, so use a lower settting while experimenting.
One of the reasons that we can use Terragen to create skyboxes is that it uses a camera that you can control in a very exact way. Making a skybox is a matter of:
To set up tha camera, you:
You think that is a lot of work? Well, not really, but I'm a nice guy so I made a script that you can run by pressing the "Animation..." button in the "Render Control" dialog window. Then press the "Execute script" and select a *.tgs ( Terragen script ) file. You can copy this text into a blank *.txt file and rename it to the *.tgs extension:
; The folder specified in InitAnim must already exist. initanim "C:\temp\sky_", 1 ; (necessary before using FRend) CamH 270 CamP 0 CamB 0 Zoom 1 frend CamH 0 CamP 0 CamB 0 Zoom 1 frend CamH 90 CamP 0 CamB 0 Zoom 1 frend CamH 180 CamP 0 CamB 0 Zoom 1 frend CamH 180 CamP 90 CamB 0 Zoom 1 frend CamH 180 CamP -90 CamB 0 Zoom 1 frend
The files generated will be saved in c:\temp and they will be named sky_0001.bmp to sky_0006.bmp.
If you think the angles and sequences are a bit strange, its because if you sequence the camera with these angles: you will get the same angles as in MOH:AA ( so the view of "up" and "left" that you see in Terragen will match the view of "up" and "left" that you see in Radiant ). This makes it easier to line up the direction of the sunlight and features of the map in general in Radiant to match the skybox.
As MOH:AA does not support the *.bmp format, you must convert the images to jpeg or targa format. As the skybox uses no alpha channel, I suggest using JPEG format ( its also smaller ). If you dont have a good program to convert the images: I suggest you get IrfanView? http://www.irfanview.com/. Its free for personal use and a very competent viewer indeed.
A skybox shader is a bit different than regular shaders:
textures/sky/my_very_own_sky
{
qer_editorimage textures/sky/my_very_own_sky_editor_image.tga
qer_keyword utility
qer_keyword sky
surfaceparm nolightmap
surfaceparm noimpact
surfaceparm sky
skyParms env/my_very_own_sky - -
}
...this shader says a few things, so from top line:
Put the shader above in a text file and rename the file "my_very_own_sky.shader" and place it in the "<MOHAA>\main\scripts" folder.
As I mentioned in the shader section, the files need to be named in a special way. The file names must start with the name stated in the shader, and then special keywords are added to the end of the name.
Rename the files like this (copy this into a *.bat file so you can just run the batch file instead of doung the boring renaming manually ):
rename sky_0001.jpg my_very_own_sky_ft.jpg rename sky_0002.jpg my_very_own_sky_lf.jpg rename sky_0003.jpg my_very_own_sky_bk.jpg rename sky_0004.jpg my_very_own_sky_rt.jpg rename sky_0005.jpg my_very_own_sky_up.jpg rename sky_0006.jpg my_very_own_sky_dn.jpg pause
If you really eyeball the renaming you will see that it looks wrong... according to that renaming, the left and right textures will end up in switched places... yes they will, but thats because how MOH:AA wants it.
Place all the files in the "<MOHAA>\main\env" folder and you are almost done.
Now make a 64 * 64 thumbnail of one of the images that is most representative of the sky, rename it to "my_very_own_sky_editor_image.jpg" and place it in the "<MOHAA>\main\textures\sky\" folder.
By now you should be able to use your texture on a skybox in Radiant. B-)
PROBLEM: You get the following error when loading a map with your home made sky texture: LoadTGA: Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported.
SOLUTION: (Courtesy Markus Kuhn): You are trying to use a .jpg in a shader script. All shader scripts call for .TGA textures, even though the actual texture may be a .jpg. If the shader script is correct and you're still getting the error, then it means that you have saved the textures as progressive .jpgs. You've seen these on some web sites, where the picture is downloaded in phases, showing increasingly detailed versions of the entire image. The Q3 rendering engine cannot render these textures. You must save the .jpgs as baseline optimized.
Well, thats all for now, hope you can use it.
- Bjarne